<?php
require 'include.php';//导入库文件
require 'config.php';


$rss = 'http://feeds.feedburner.com/china-week';

if (($xml = file($rss)) || $xml)
{
	set_time_limit(0);
	$data = implode('', $xml);
	#创建XML解析器
	$parser = xml_parser_create();
	xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
   	xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
   	xml_parse_into_struct($parser, $data, $values, $tags);
    xml_parser_free($parser);
	$array = wt_xml::readFeedburnerRSS($xml, $rss);
	$title = $values[2]['value'];
	foreach ($tags as $key=>$val) 
    {
    	//如果是博文信息
       	if ($key == 'item')
       	{
       		$table['post'] = wt_xml::selectXMLKey($val, $values, $rss);
       	}
		else
		{
           	continue;
       	}
    }
}


foreach (array_reverse($table['post']) as $v)
{
	if (wt_xml::getLastUpdate($rss) < strtotime($v['pubDate']))
	{
		print_r($v);
		$BID = wt_xml::getBlogID($rss);
		wt_xml::addPost($v, $BID);
	}
}